<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>

    <th:block th:include="include::header"></th:block>


    <link th:href="@{${basePath}+'/plugin/hplus/css/login.css'}" rel="stylesheet">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>

</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>[ 兴隆山景区年票管理系统]</h1>
                </div>
                <div class="m-b"></div>
                <h4>  欢迎使用 <strong>兴隆山景区年票管理系统</strong></h4>
                <ul class="m-b">

                </ul>

            </div>
        </div>
        <div class="col-sm-5">
            <form id="fsForm">
                <h4 class="no-margins">登录：</h4>
                <p class="m-t-md">登录兴隆山景区年票管理系统</p>
                <input type="text" name="username" class="form-control uname" placeholder="用户名" />
                <input type="password" name="password" class="form-control pword m-b" placeholder="密码" />
                <button class="btn btn-success btn-block">登录</button>

            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2018 All Rights Reserved.
        </div>
    </div>
</div>

<th:block th:include="include::footer"></th:block>

<script th:inline="javascript">
    var basePath=[[${basePath}]];
    $(document).ready(function() {
        validate();
    });
    $.validator.setDefaults({
        submitHandler : function() {
            login();
        }
    });

    function login() {
        $.ajax({
            type : "POST",
            url : basePath+"/login",
            data : $('#fsForm').serialize(),
            success : function(r) {
                if (r.code ==200) {
                    parent.location.href =basePath+ '/index';
                } else {
                    layer.msg(r.msg);
                }
            }
        });
    }

    function validate() {
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#fsForm").validate({
            rules : {
                username : {
                    required : true
                },
                password : {
                    required : true
                }
            },
            messages : {
                username : {
                    required : icon + "请输入您的用户名",
                },
                password : {
                    required : icon + "请输入您的密码",
                }
            }
        })
    }


</script>

</body>

</html>
